#!/bin/sh /etc/rc.common
# (C) 2008 openwrt.org

START=100


load_fpkg_config() {
        local plugin_name=
        local plugin_autorun=
        local plugin_type=
        for line in $(uci show fpkg | grep "=globals")
        do
                plugin_name=${line%=globals}
                plugin_autorun=`echo $(uci get $plugin_name".plugin_Autorun") | tr -d " " | tr -d "0"`
                plugin_type=$(uci get $plugin_name".plugin_Type")
                if [ ! -z $plugin_autorun ];then
                        #xcloud plugin
                        if [ ${plugin_type}"x" == "xcloudx" ];then
                                echo $plugin_name >> /tmp/autorun
                                local real_path=`/usr/local/firefly-api/get_app_install_path $plugin_name`
                                if [ -z "$real_path" ];then
                                    sh $real_path"appshell" start >> /tmp/autorun
                                else
                                    echo "not installed ">> /tmp/autorun
                                fi
                        fi
                fi
        done

}

start() {                                                
        load_fpkg_config                                                                    
}  
